﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RN.ERP.DAL.Context;
using Newtonsoft.Json;
using RN.ERP.Entity.WF;

namespace RN.ERP.BLL.WF
{
    public partial class EnterpriseBLL : BaseEnterpriseBLL
    {
        #region dbContext
        private WFDATA_Context dbContext
        {
            get
            {
                return (WFDATA_Context)base.baseContext;
            }
        }

        public EnterpriseBLL()
        {
            base.baseContext = new WFDATA_Context();
        }
        #endregion

        public override string GetCorpQualities(string corpUserGuid, string areaCode)
        {
            Guid guid;
            List<Tb_Corp_QualitY> ret = new List<Tb_Corp_QualitY>();
            if (!Guid.TryParse(corpUserGuid, out guid))
            {
                return JsonConvert.SerializeObject(ret);
            }
            ret = dbContext.Corp_CompanyQualitiesWF.Where(m => m.CorpUserGuid == guid && (m.IsDel == false || m.IsDel == null)).OrderByDescending(m1 => m1.IsMain).ToList();
            int cnt = ret.Count;
            return JsonConvert.SerializeObject(ret);
        }

        
    }
}
